<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AlterOgzContact extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('ogz', function (Blueprint $table) {
            $table->dropColumn('contact');
            $table->string('user_id',255)->after('sort')->default('')->comment('多个联系人');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        if (Schema::hasColumn('ogz', 'user_id')){
            Schema::table('ogz', function (Blueprint $table) {
                $table->dropColumn('user_id');
                //renameColumn只能是同类型

                $table->integer('contact')->after('sort')->default(0)->comment('联系人');
            });
        }

    }
}
